﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Hopscotch.Presentation.Common.Converters;
using FluentAssertions;
using NUnit.Framework;



namespace Hopscotch.Presentation.Common.Test.Converters
{
    [TestFixture]
    public class StringToVisibiltyConverterTest
    {
        private StringToVisibiltyConverter stringToVisibiltyConverter;

        [SetUp]
        public void SetUp()
        {
            stringToVisibiltyConverter = new StringToVisibiltyConverter();
        }

        [Test]
        public void TestDefaultTargetValues()
        {
            stringToVisibiltyConverter.EmptyValue.Should().Be(Visibility.Collapsed);
            stringToVisibiltyConverter.TextValue.Should().Be(Visibility.Visible);
        }

        [TestCase("")]
        [TestCase(null)]
        public void TestConvertNullShouldNotBeVisible(string str)
        {
            var emptyValue = stringToVisibiltyConverter.EmptyValue;
            stringToVisibiltyConverter.Convert(str, typeof(Visibility), null, null).Should().Be(emptyValue);
        }

        [TestCase("Test")]
        public void TestConvertTextShouldBeVisible(string str)
        {
            var textValue = stringToVisibiltyConverter.TextValue;
            stringToVisibiltyConverter.Convert(str, typeof(Visibility), null, null).Should().Be(textValue);
        }

        [TestCase("")]
        [TestCase(null)]
        public void TestConvertNullShouldBeEmptyValue(string str)
        {
            stringToVisibiltyConverter.EmptyValue = Visibility.Hidden;
            stringToVisibiltyConverter.Convert(str, typeof(Visibility), null, null).Should().Be(Visibility.Hidden);
        }

        [TestCase("Hello")]
        public void TestConvertNullShouldBeTextValue(string str)
        {
            stringToVisibiltyConverter.TextValue = Visibility.Hidden;
            stringToVisibiltyConverter.Convert(str, typeof(Visibility), null, null).Should().Be(Visibility.Hidden);
        }
    }
}
